package com.sfd.gateway;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

import java.net.InetAddress;

/**
 * @author haden
 * @date 2022/8/11 16:28
 **/
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
@Slf4j
public class SfdCloudGatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(SfdCloudGatewayApplication.class);
    }

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
        return args -> log.info("项目:" + ctx.getEnvironment().getProperty("spring.application.name") + "启动啦，访问路径：{}", "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + ctx.getEnvironment().getProperty("server.port"));
    }
}
